
clear all 
use the_dataset.dta

keep if  standard == 1

keep culture1 culture2 culture_d  unemp culture1 case_1 case_2 CCAA1 ///
educ_basic1-educ_sup1 age051-age661 income1 income2 income_d NMIEMB1 size_dummy1-size_dummy5 number_spanish1 ccaadummy1-ccaadummy17 ANOENC1 yeardummy1-yeardummy9
global covariates educ_basic1-educ_sup1 age051-age661 income1 NMIEMB1 size_dummy1-size_dummy5 number_spanish1
order income1 age051-age661 educ_basic1-educ_sup1 size_dummy1-size_dummy5 NMIEMB1 number_spanish1


* RAW T01
* control
preserve
keep if unemp == 0 & case_1==1
keep $covariates
outreg2 using descrip_c.tex, replace sum(log)  eqkeep(mean sd)
restore

* treatment
preserve
keep if unemp == 1 & case_1==1
keep $covariates
outreg2 using descrip_t.tex, replace sum(log)  eqkeep(mean sd)
restore

* differences
preserve
keep if case_1 == 1 
keep if unemp == 0 | unemp == 1
keep $covariates unemp
foreach j of varlist income1-number_spanish1  {   
reg `j' unemp
}
restore

* RAW T12
* control
preserve
keep if unemp == 0 & case_2==1
keep $covariates
outreg2 using descrip_c.tex, replace sum(log)  eqkeep(mean sd)
restore

* treated
preserve
keep if unemp == 1 & case_2==1
keep $covariates
outreg2 using descrip_t.tex, replace sum(log)  eqkeep(mean sd)
restore

* differences
preserve
keep if case_2 == 1 
keep if unemp == 0 | unemp == 1
keep $covariates unemp
foreach j of varlist income1-number_spanish1  {   
reg `j' unemp
}
restore

* for the new control subsample T01
preserve
keep if case_1==1
gen var = _n
merge 1:1 var using "trimmedt01.dta"
keep if culture_1==1
keep educ_basic1-educ_sup1 age051-age661 income1 NMIEMB1 size_dummy1-size_dummy5 number_spanish1
order income1 age051-age661 educ_basic1-educ_sup1 size_dummy1-size_dummy5 NMIEMB1 number_spanish1
outreg2 using descrip_c.tex, replace sum(log)  eqkeep(mean sd)
restore

* differences using the new control subsample T01
preserve
keep if case_1==1 
gen var = _n
merge 1:1 var using "trimmedt01.dta"
keep if culture_1 ==1 | unemp == 1 
keep educ_basic1-educ_sup1 age051-age661 income1 NMIEMB1 size_dummy1-size_dummy5 number_spanish1 unemp
order income1 age051-age661 educ_basic1-educ_sup1 size_dummy1-size_dummy5 NMIEMB1 number_spanish1
foreach j of varlist income1-number_spanish1  {   
reg `j' unemp
}
restore

* for the new control subsample T12
preserve
keep if case_2==1 
gen var = _n
merge 1:1 var using "trimmedt12.dta"
keep if culture_2==1
keep educ_basic1-educ_sup1 age051-age661 income1 NMIEMB1 size_dummy1-size_dummy5 number_spanish1
order income1 age051-age661 educ_basic1-educ_sup1 size_dummy1-size_dummy5 NMIEMB1 number_spanish1
outreg2 using descrip_c.tex, replace sum(log)  eqkeep(mean sd)
restore

* differences using the new control subsample T12
preserve
keep if case_2==1 
gen var = _n
merge 1:1 var using "trimmedt12.dta"
keep if culture_2==1 | unemp == 1 
keep educ_basic1-educ_sup1 age051-age661 income1 NMIEMB1 size_dummy1-size_dummy5 number_spanish1 unemp
order income1 age051-age661 educ_basic1-educ_sup1 size_dummy1-size_dummy5 NMIEMB1 number_spanish1
foreach j of varlist income1-number_spanish1  {   
reg `j' unemp
}
restore








